﻿namespace _111.Models
{
    /// <summary>
    /// 企业微信自定义更新类
    /// </summary>
    public class QywxUpdateDetail
    {
        /// <summary>
        /// 应用Id
        /// </summary>
        public string AgentId { get; set; }
        public string CorpId { get; set; }
        /// <summary>
        /// 密钥
        /// </summary>
        public string Secret { get; set; }
        public string AesIv { get; set; }
        public string AesKey { get; set; }
        /// <summary>
        /// 更改的用户Ids
        /// </summary>
        public List<string> UseridList { get; set; }
        /// <summary>
        /// 类型 1、关键数据2、图片3、列表4、webview
        /// </summary>
        public int Type { get; set; }
        /// <summary>
        /// 推送实体
        /// </summary>
        public object Content { get; set; }
    }

    public class QywxGetModel : WXResponse
    {
        public string type { get; set; }
        public imageDetail? image { get; set; }
        public keydataDetail<keydataItemsDetail>? keydata { get; set; }
        public keydataDetail<listItemsDetail>? list { get; set; }
        public webViewDetail? webview { get; set; }
    }
    /// <summary>
    /// 图片型上传
    /// </summary>
    public class QywxImageRequest
    {
        public string agentid { get; set; }
        public string secret { get; set; }
        public string type { get; set; }
        public List<string> userid_list { get; set; }
        public imageDetail image { get; set; }
    }

    public class imageDetail
    {
        public string? url { get; set; }
        public string? jump_url { get; set; }
    }
    /// <summary>
    /// 关键数据型上传
    /// </summary>
    public class QywxKeyRequest
    {
        public string agentid { get; set; }
        public string secret { get; set; }
        public string type { get; set; }
        public List<string> userid_list { get; set; }
        public keydataDetail<keydataItemsDetail> keydata { get; set; }
    }

    public class keydataDetail<T>
    {
        public List<T>? items { get; set; }
    }

    public class keydataItemsDetail
    {
        public string? key { get; set; }
        public string? data { get; set; }
        public string? jump_url { get; set; }
        public string? pagepath { get; set; }
    }


    /// <summary>
    /// 列表型上传
    /// </summary>
    public class QywxListRequest
    {
        public string agentid { get; set; }
        public string secret { get; set; }
        public string type { get; set; }
        public List<string> userid_list { get; set; }
        public keydataDetail<listItemsDetail> list { get; set; }
    }

    public class listItemsDetail
    {
        public string? title { get; set; }
        public string? jump_url { get; set; }
        public string? pagepath { get; set; }
    }

    /// <summary>
    /// 列表型上传
    /// </summary>
    public class QywxWebViewRequest
    {
        public string agentid { get; set; }
        public string secret { get; set; }
        public string type { get; set; }
        public List<string> userid_list { get; set; }
        public webViewDetail webview { get; set; }
    }

    public class webViewDetail
    {
        public string? url { get; set; }
        public string? jump_url { get; set; }
        public string? pagepath { get; set; }
        public string? height { get; set; }
        public string? hide_title { get; set; }
        public string? enable_webview_click { get; set; }
    }

    /// <summary>
    /// 前端调用的基础数据组
    /// </summary>
    public class QywxTotalModel
    {
        public string agentid { get; set; }
        public string secret { get; set; }
        public string type { get; set; }
        public List<string> userid_list { get; set; } = new List<string>();
        public imageDetail? image { get; set; }
        public keydataDetail<keydataItemsDetail>? keydata { get; set; }
        public keydataDetail<listItemsDetail>? list { get; set; }
        public webViewDetail? webview { get; set; }
    }

    public class WXResponse
    {
        public int errcode { get; set; }
        public string errmsg { get; set; }
    }

    public class WXUserListResponse : WXResponse
    {
        public string next_cursor { get; set; }
        public List<WXUserDetailList> dept_user {  get; set; }
    }

    public class WXUserDetailList
    {
        public string userid { get; set; }
        public string department { get; set; }
    }
}
